<table id="manage_localInfo" data-options="fit:true"></table>
<script>
$(function(){
	$('#manage_localInfo').datagrid({
		url:'../json/LocalInfo_getLocalInfoList',
		loadMsg:'数据加载中...',
		fitColumns:true,
		rownumbers:true,
		striped:true,
		sortName:'lid',
		sortOrder:'asc',
		remoteSort:false,
		columns:[[
			{field:'lids',title:'',width:100,align:'center',checkbox:true},
			{field:'lid',title:'景点编号',width:100,align:'center',sortable:true},
			{field:'lname',title:'景点名称',width:100,align:'center'}, 
			{field:'ltype',title:'景点类型',width:100,align:'center'},
			{field:'lseason',title:'适宜季节',width:100,align:'center'},
			{field:'ltime',title:'开放时间',width:100,align:'center'}
		]],toolbar: [{
			iconCls: 'icon-add',
			text:'添加',
			handler: function(){
				$("#add_localInfo").dialog("open");
			}
		}]
	});
	
});

function addLocalInfo(){
	var lname=$("#li_lname").val();
	var ltype=$("#li_ltype").val();
	var ltext=$("#li_ltext").val();
	var lseason=$("#li_lseason").val();
	var ltime=$("#li_ltime").val();
	var laddr=$("#li_laddr").val();
	var ltel=$("#li_ltel").val();
	var lintrouduce=$("#li_lintroduce").val();
	$.ajaxFileUpload({
		url:"../json/LocalInfo_addLocalInfo",
		fileElementId:["li_lpic","li_lvideo"],
		type:"POST",
		secureuri:false,
		dataType:"JSON",
		data:{
			"lname":lname,
			"ltype":ltype,
			"ltext":ltext,
			"lseason":lseason,
			"ltime":ltime,
			"laddr":laddr,
			"ltel":ltel,
			"lintrouduce":lintrouduce
		},
		success:function(data){
			console.info(data);
			if(data[7]==1){
				$.messager.show({
					title:'成功提示',
					msg:'景点添加成功添加成功...',
					timeout:3000,
					showType:'slide'
				});
				$('#add_localInfo').dialog("close");
				$("#li_lname").val("");
				$("#li_ltype").val("");
				$("#li_laddr").val("");
				$("#li_ltel").val("");
				$("#li_lpic").val("");
				$("#li_lvideo").val("");
				$("#li_lseason").val("");
				$("#li_ltime").val("");
				$("#li_ltext").val("");
				$("#li_lintroduce").val("");
				
				$('#manage_localInfo').datagrid("reload");
			}else{
				$.messager.alert('错误提示','景点添加失败,请稍后重试...','error');
			}
		}
	});
}
</script>
<div id="add_localInfo" class="easyui-dialog" title="添加景点" style="width: 800px; height: 560px;"
	data-options="iconCls:'icon-add',resizable:true,modal:true,closed:true">
	<div style="margin:0px 0px 20px 30px;position: relative;">
			<br /><br />
			<label for="li_lname">景区名称：</label><input type="text" id="li_lname"/>
			<br /><br />
			<label for="li_ltype">景区类型：</label><input type="text" id="li_ltype"/> 
			<br /><br />
			<label for="li_laddr">景区地址：</label><input type="text" id="li_laddr"/>
			<br /><br />
			<label for="li_ltel">景区电话：</label><input type="text" id="li_ltel"/>
			<br /><br />
			<label for="li_lpic">景区图片：</label><input type="file" id="li_lpic" name="upload" onchange="fileSelect(this)"/>
			<br /><br />
			<label for="li_lvideo">景区视频：</label><input type="file" id="li_lvideo" name="upload"/>
			<br /><br />
			<label for="li_lseason">适宜季节：</label><input type="text" id="li_lseason"/>
			<br /><br />
			<label for="li_ltime">开放时间：</label><input type="text" id="li_ltime"/>
			<br /><br />
			<label for="li_ltext" style="vertical-align:top;">景区简介：</label><textarea rows="2" cols="100" id="li_ltext"></textarea>
			<br /><br />
			<label for="li_lintroduce" style="vertical-align:top;">详细介绍：</label><textarea rows="5" cols="100" id="li_lintroduce"></textarea>
			<br /><br />
			<div id="Preview" style="position: absolute;width: 400px;height:300px;border: 1px solid #ccc;right:70px;top:20px;">
				<p style="font-size: 30px;text-align: center;line-height: 300px;">图片预览</p>
			</div>
			<p style="text-align: center"><input style="padding: 5px 25px;" type="button" onclick="addLocalInfo()" value="添加"/></p>
	</div>
</div>
